#include <iostream>
#include <vector>

using namespace std;
class Solution {
public:
    bool isMatch(string s, string p) {
        if(p.length() == 0){
            return s.length() == 0;
        }

        int p_len = p.length();
        int s_len = s.length();
        vector<vector<bool>> dp(s_len+1, vector<bool> (p_len+1));
        dp[0][0] = true;

        for(int i =2; i<=p_len; i+=2){
            dp[0][i] = dp[0][i-2] && p[i-1]=='*';
        }


        for (int i = 1; i <= s_len; i++)
        {
            for (int j = 1; j <= p_len; j++)
            {
                if(p[j-1] == '*'){
                    //匹配0次j-是否匹配
                    if(j>=2){
                        dp[i][j] = dp[i][j-2];
                    }
                    //匹配多次看i-1是否匹配
                    if(i>=1 && j>=2 &&(s[i-1]==p[j-2] || p[j-2]=='.')){
                        dp[i][j] = dp[i][j] || dp[i-1][j];
                    }
                }
                else if(s[i-1]==p[j-1] || p[j-1]=='.'){
                    dp[i][j] = dp[i-1][j-1];
                }
            }
        }
        return dp[s_len][p_len];
    }
};
int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}